export default function (config) {
  const defaultPopupProps = Object.assign({
    closeOnClickOverlay: false,
  }, config);

  return {
    props: {
      value: {
        type: Object,
        default: () => ({}),
      },
      visible: {
        type: Boolean,
        default: false,
      }
    },
    data() {
      return {
        defaultPopupProps,
      };
    },
    computed: {
      popupData: {
        get() {
          return this.value;
        },
        set(value) {
          this.$emit('input', value);
        }
      },
      showing: {
        get() {
          return this.visible;
        },
        set(value) {
          this.$emit('update:visible', value)
        }
      }
    }
  };
};
